// function sum(num1: number, num2: number) {
//     return num1 + num2
// }

// 函数的剩余参数
function sum (initalNum: number, ...nums: number[]) {
    let total = initalNum
    for (const num of nums) {
        total += num
    }
    return total
}
console.log(sum(1,2,3));
console.log(sum(1,2));
console.log(sum(1, 2, 3, 4, 5));


